package com.cupk.carManageMaster.config;

import com.cupk.carManageMaster.Interceptor.UserInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 名称WebMvcConfig
 * 描述WebMvcConfigurer
 *
 * @version 1.0
 * @author:wanghao
 * @datatime:2023,06,01,15,57
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
    @Bean
    public UserInterceptor getUserInterceptor() {
        return new UserInterceptor();
    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        /**
         * 拦截器按照顺序执行
         */
        registry.addInterceptor(getUserInterceptor()).excludePathPatterns("/user/login");
        super.addInterceptors(registry);
    }

}
